package com.hktf.moedokilock.activity;

import android.content.pm.PackageManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.hktf.corelib.utils.CommUtils;
import com.hktf.corelib.utils.FileUtil;
import com.hktf.moedokilock.R;
import com.hktf.uilib.app.BaseActivity;

public class AboutActivity extends BaseActivity implements
        OnClickListener {


    private TextView version;

    @Override
    public int getLayoutResID() {
        return com.hktf.moedokilock.R.layout.act_about;
    }

    @Override
    public void initView() {
        initTitleView();
        version = (TextView) findViewById(R.id.txt_version);
        String versionNum = getVersionCode();
        version.setText(versionNum);
    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData() {

    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        CommUtils.closeInput(v);
    }


    public void onDestroy() {
        super.onDestroy();
    }


    private String getVersionCode() {
        String versionCode = "";
        try {
            // 获取软件版本号，对应AndroidManifest.xml下android:versionCode
            versionCode = FileUtil.getVersion(this.getPackageManager()
                    .getPackageInfo(this.getPackageName(), 0).versionName);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return versionCode;

    }

    private void initTitleView() {
        setTitle(getString(com.hktf.moedokilock.R.string.about_us));
        setBackClick();

    }
}
